package com.situ.crm.controller.back;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.situ.crm.common.ServerResponse;
import com.situ.crm.entity.SaleChance;
import com.situ.crm.service.ISaleChanceService;

@Controller
@RequestMapping("/salechance")
public class SaleChanceController {

	@Autowired
	private ISaleChanceService saleChanceService;

	// 跳转到展示界面
	@RequestMapping("/getPage")
	public String getPage() {

		return "/salechance/salechance";
	}

	// 分页查询
	@RequestMapping("/pageList")
	@ResponseBody
	public ServerResponse pageList(Integer page, Integer limit) {
		ServerResponse serverResponse = saleChanceService.pageList(page, limit);

		return serverResponse;
	}

	// 跳转到添加界面
	@RequestMapping("/add")
	public String add() {

		return "/salechance/salechance_add";
	}

	// 添加功能
	@RequestMapping("/insert")
	@ResponseBody
	public ServerResponse insert(SaleChance saleChance) {
		ServerResponse serverResponse = saleChanceService.insert(saleChance);

		return serverResponse;
	}

}
